package flc.ast.utils;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;

import java.util.List;

import flc.ast.bean.OvertimeBean;


@Dao//对表操作，增删改查
public interface OvertimeDao {
    @Insert
    void insertOvertime(OvertimeBean... overtimeBeans);

    @Update
    void updateOvertime(OvertimeBean... overtimeBeans);

    //条件删除
    @Delete
    void deleteOvertime(OvertimeBean... overtimeBeans);

    //删除所有
    @Query("DELETE FROM OvertimeBean")
    void deleteAllOvertime();

    @Query("SELECT * FROM OvertimeBean ORDER BY ID DESC")
    List<OvertimeBean>getAllOvertime();

    @Query("SELECT * FROM OvertimeBean WHERE DATE = :date")
    List<OvertimeBean> getTodayOvertime(long date);

    @Query("SELECT * FROM OvertimeBean WHERE DATE >= :startDate AND date <= :endDate")
    List<OvertimeBean> getWeekOvertime(long startDate, long endDate);

    @Query("SELECT * FROM OvertimeBean WHERE DATE >= :startDate AND date < :endDate")
    List<OvertimeBean> getMonthOvertime(long startDate, long endDate);

}

